package com.cmc.cloud.cmclink.doc.controller.admin.multimodaltransport;

import com.cmc.cloud.cmclink.doc.constants.UrlConstants;
import com.cmc.cloud.cmclink.doc.service.multimodaltransport.BargeMultiCalculationService;
import com.cmc.cloud.cmclink.doc.vo.multimodaltransport.multiop.*;
import com.cmes.framework.common.pojo.CommonResult;
import com.cmes.framework.operatelog.core.annotations.OperateLog;
import com.cmes.framework.operatelog.core.enums.OperateTypeEnum;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * 多式联运-驳船多功能计算Controller
 *
 * @author codegen
 */
@Tag(name = "管理后台 - 驳船多功能计算")
@RestController
@Validated
@RequestMapping(UrlConstants.APPLICATION_URL + "/bargeCalculation")
public class BargeMultiCalculationController {

    @Resource
    private BargeMultiCalculationService bargeMultiCalculationService;

    @Operation(summary = "进口-驳船多功能计算")
    @PostMapping("/im")
    @OperateLog(type = OperateTypeEnum.GET)
    @PreAuthorize("@ss.hasPermission('doc:importBargeMultiCalculation:search')")
    public CommonResult<List<BargeMultiCalculationRespVO>> queryImBargeMultiCalculation(@Valid @RequestBody BargeMultiCalculationReqVO req) {
        return CommonResult.success(bargeMultiCalculationService.queryImExBargeMultiCalculation(req));
    }


    @Operation(summary = "出口-驳船多功能计算")
    @PostMapping("/ex")
    @OperateLog(type = OperateTypeEnum.GET)
    @PreAuthorize("@ss.hasPermission('doc:exportBargeMultiCalculation:search')")
    public CommonResult<List<BargeMultiCalculationRespVO>> queryExBargeMultiCalculation(@Valid @RequestBody BargeMultiCalculationReqVO req) {
        return CommonResult.success(bargeMultiCalculationService.queryImExBargeMultiCalculation(req));
    }

    @Operation(summary = "完船")
    @PostMapping("/multiFinishOperation")
    @OperateLog(type = OperateTypeEnum.UPDATE)
    @PreAuthorize("@ss.hasPermission('doc:importBargeMultiCalculation:finishVessel')")
    public CommonResult<Void> multiFinishOperation(@Valid @RequestBody MultiFinishOperationReqVO multiFinishOperationReqVo) {
        bargeMultiCalculationService.multiFinishOperation(multiFinishOperationReqVo);
        return CommonResult.success();
    }



}
